﻿using HuiZe.education.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HuiZe.education.View
{
    /// <summary>
    /// CourseShowView.xaml 的交互逻辑
    /// </summary>
    public partial class CourseShowView : Window
    {
        List<AttendUserModel> attlist;
        public CourseShowView()
        {
            InitializeComponent();
        }
        public CourseShowView(List<AttendUserModel> alist)
        {
            InitializeComponent();
            attlist = alist;
            Loaded += CourseShow_Loaded;

        }
        private void CourseShow_Loaded(object sender, RoutedEventArgs e)
        {
            GetWPModel();
   
        }
        public void GetWPModel()
        {

            if(attlist!=null)
            {
                foreach(var att in attlist)
                {
                    Label label = new Label();
                    label.Content = att.UserName;
                    label.FontSize = 28;
                    label.Margin=new Thickness(10,5,10,5);
                    if (att.UserType == "2")
                    {
                        label.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f65151"));
                    }
                    else if(att.UserType=="1")
                    {
                        label.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#55e4c2"));
                    }else
                    {
                        label.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#777777"));
                    }
                    wpNameList.Children.Add(label);
                }
            }
           
        }
        private static CourseShowView couseShow;

        public static CourseShowView GetCourseShowInfo()
        {
            if(couseShow==null)
                couseShow=new CourseShowView();

            return couseShow;
        }
        private void CommonTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}
